<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>

    function checkNum(num) {
      var numrel = "";
      if ((num & 1) === 0) {
        numrel = "这是一个偶数";
      } else {
        numrel = "这是一个奇数";
      }
      return numrel;
    }
    var numtest = checkNum(6);
    console.log(numtest);//弹出提示“这是一个奇数”

    arr = [1, 2, 4, 6, 9, 11, 18, 361, 5622, 5623]
    arr.forEach(function (el) {
      if (parseInt(el.toString(2)) & 1 === 0) {
        console.log(`${el} in binary is ${el.toString(2)} and it is an EVEN number`);
      } else {
        console.log(`${el} in binary is ${el.toString(2)} and it is an ODD number`);
      }
    });
  </script>

</body>

</html>